package com.eshop.dao;

import com.eshop.dao.provider.UserInfoDynaSqlProvider;
import com.eshop.pojo.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface UserInfoDao {
        @Select("select * from user_info where status=1")
    public List<UserInfo> getValidUser();//获取合法用户

        @Select("select * from user_info where id=#{id}")
    public UserInfo getUserInfoById(int id);//根据用户id查找用户

        @SelectProvider(type = UserInfoDynaSqlProvider.class,method = "selectByPage")
    List<UserInfo> selectByPage(Map<String ,Object>param);//分页获取客户信息

        @SelectProvider(type = UserInfoDynaSqlProvider.class,method = "count")
    Integer count(Map<String ,Object>param);//根据条件查询客户总数

       @Update("UPDATE user_info set status = #{flag} where id in ( ${ids} )")
       int updateStatus(@Param("ids") String ids, @Param("flag") String flag);//跟新用户状态
}
